# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=lomiri-deviceinfo
pkgver=0.2.1
pkgrel=1
pkgdesc="Library to detect and configure devices"
url="https://gitlab.com/ubports/development/core/deviceinfo"
arch="all"
license="GPL-3.0-only"
makedepends="
	cmake
	cmake-extras
	gtest-dev
	samurai
	yaml-cpp-dev
"
subpackages="$pkgname-dev"
source="https://gitlab.com/ubports/development/core/deviceinfo/-/archive/$pkgver/deviceinfo-$pkgver.tar.gz"
builddir="$srcdir/deviceinfo-$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=none \
		-DCONFIG_PATH=/etc/lomiri-deviceinfo
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
454ad8755f7b23b739adde42e3d4e1fe80626e0e9e5b9f4dfa29fd7a62161f8363e389bd28fca5caccffdf4162758d46d8b66386e9b2163593c5f60c1e693c0a  deviceinfo-0.2.1.tar.gz
"
